package com.cloudcross.ssp.model.rpt;

import java.util.Date;

import com.cloudcross.ssp.common.utils.DoublePreciseCompute;

/**
 * 报表基类 报表的公共属性
 * 
 * @author wuqiang.du
 */
public class Report {
    private int    id;
    private short  advertiserId;      //广告主ID
    private int    orderId;           //订单ID
    private int    adgroupId;         //策略ID
    private int    bannerId;          //创意ID
    private short  locationId;        //地域ID
    private Date   date;              //日期
    private int    req;               //请求数
    private int    show;              //曝光
    private int    click;             //点击
    private double  ecpm;              //千次曝光成本
    private double  consume;           //花费
    private double clickRate;         //点击率   click/show
    private double showRate;          //曝光占比
    //总数
    private int    reqs      = 0;     //请求总数
    private int    shows     = 0;     //曝光总数
    private int    clicks    = 0;     //点击总数
    private double ecpms     = 0.0;   //千次曝光成本总数   1000*(consumes/shows)
    private float  consumes  = 0.0f;  //花费总数
    private double clickRates;        //点击率  clicks/shows
    private double showRates = 100.00; //曝光占比

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public short getAdvertiserId() {
        return advertiserId;
    }

    public void setAdvertiserId(short advertiserId) {
        this.advertiserId = advertiserId;
    }

    public int getOrderId() {
        return orderId;
    }

    public void setOrderId(int orderId) {
        this.orderId = orderId;
    }

    public short getLocationId() {
        return locationId;
    }

    public void setLocationId(short locationId) {
        this.locationId = locationId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public int getShow() {
        return show;
    }

    public void setShow(int show) {
        this.show = show;
    }

    public int getClick() {
        return click;
    }

    public void setClick(int click) {
        this.click = click;
    }

    public double getEcpm() {
        return ecpm;
    }

    public void setEcpm(double ecpm) {
        this.ecpm = ecpm;
    }
 
    public double getConsume() {
        return consume;
    }

    public void setConsume(double consume) {
        this.consume = consume;
    }

    public double getClickRate() {
        return (this.show == 0) ? 0.0 : DoublePreciseCompute.div(this.click * 100.0, this.show);
    }

    public void setClickRate(double clickRate) {
        this.clickRate = clickRate;
    }

    public double getShowRate() {
        return showRate;
    }

    public void setShowRate(double showRate) {
        this.showRate = showRate;
    }

    public int getShows() {
        return shows;
    }

    public void setShows(int shows) {
        this.shows = shows;
    }

    public int getClicks() {
        return clicks;
    }

    public void setClicks(int clicks) {
        this.clicks = clicks;
    }

    public double getEcpms() {
        return this.shows == 0 ? 0.0 : DoublePreciseCompute.div(this.consumes * 1000.0, this.shows);
    }

    public void setEcpms(double ecpms) {
        this.ecpms = ecpms;
    }

    public float getConsumes() {
        return consumes;
    }

    public void setConsumes(float consumes) {
        this.consumes = consumes;
    }

    public double getClickRates() {
        return (this.shows == 0) ? 0.0 : DoublePreciseCompute.div(this.clicks * 100.0, this.shows);
    }

    public void setClickRates(double clickRates) {
        this.clickRates = clickRates;
    }

    public double getShowRates() {
        return showRates;
    }

    public void setShowRates(double showRates) {
        this.showRates = showRates;
    }

    public int getAdgroupId() {
        return adgroupId;
    }

    public void setAdgroupId(int adgroupId) {
        this.adgroupId = adgroupId;
    }

    public int getBannerId() {
        return bannerId;
    }

    public void setBannerId(int bannerId) {
        this.bannerId = bannerId;
    }

    public int getReq() {
        return req;
    }

    public void setReq(int req) {
        this.req = req;
    }

    public int getReqs() {
        return reqs;
    }

    public void setReqs(int reqs) {
        this.reqs = reqs;
    }

    @Override
    public String toString() {
        return "Report [id=" + id + ", advertiserId=" + advertiserId + ", orderId=" + orderId + ", adgroupId="
                + adgroupId + ", bannerId=" + bannerId + ", locationId=" + locationId + ", date=" + date + ", show="
                + show + ", click=" + click + ", ecpm=" + ecpm + ", consume=" + consume + ", clickRate=" + clickRate
                + ", showRate=" + showRate + ", shows=" + shows + ", clicks=" + clicks + ", ecpms=" + ecpms
                + ", consumes=" + consumes + ", clickRates=" + clickRates + ", showRates=" + showRates + "]";
    }

}
